<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div id=container>
<textarea id=textarea></textarea>
<iframe id=iframe></iframe>
</div>
<script>
// Regression test for https://crbug.com/927646
const textarea = document.getElementById('textarea');
const iframe = document.getElementById('iframe');
iframe.contentDocument.body.onpagehide = () => textarea.select();

test(() => {
  // Triggers onpagehide
  container.remove();

  // Shouldn't crash
  textarea.select();
});
</script>
